package ru.papergames.battleserver.model.battle.map;

public class Obstacle {

    private final int id;
    private final int vector;
    private final int width;
    private final int height;
    private int leftUpConnerX;
    private int leftUpConnerY;
    private final BlockedCell [] blockedCells;

    private int imageId;
    private float armour;
    private boolean armourAbs;

    public Obstacle(int id, int vector, int width, int height, BlockedCell [] blockedCells) {
        this.id = id;
        this.vector = vector;
        this.width = width;
        this.height = height;
        this.blockedCells = blockedCells;
    }

    public int getId() {
        return id;
    }

    public int getVector() {
        return vector;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public int getImageId() {
        return imageId;
    }

    public void setImageId(int imageId) {
        this.imageId = imageId;
    }

    public float getArmour() {
        return armour;
    }

    public void setArmour(float armour) {
        this.armour = armour;
    }

    public boolean isArmourAbs() {
        return armourAbs;
    }

    public void setArmourAbs(boolean armourAbs) {
        this.armourAbs = armourAbs;
    }

    public int getLeftUpConnerX() {
        return leftUpConnerX;
    }

    public void setLeftUpConnerY(int leftUpConnerY) {
        this.leftUpConnerY = leftUpConnerY;
    }

    public int getLeftUpConnerY() {
        return leftUpConnerY;
    }

    public void setLeftUpConnerX(int leftUpConnerX) {
        this.leftUpConnerX = leftUpConnerX;
    }

    public BlockedCell[] getBlockedCells() {
        return blockedCells;
    }

/*
    public void blockCellsOnMap(BattleMap map) {
        for (BlockedCell blockedCell : blockedCells) {
            Cell cell = map.getCell(leftUpConnerX + blockedCell.getX(), leftUpConnerY + blockedCell.getY());
            if (cell != null) {
                cell.setState(CellState.BUSY_WITH_OBSTACLE);
                cell.setObstacle(this);
            }
        }
    }
*/

    public static class BlockedCell {
        int x;
        int y;

        public BlockedCell(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }
    }

}
